<?php

namespace App\Jobs;

use App\Jobs\Job;
use Illuminate\Queue\SerializesModels;
use Illuminate\Queue\InteractsWithQueue;
use Illuminate\Contracts\Queue\ShouldQueue;
use Log;

class SendYuYue extends Job implements ShouldQueue
{
    use InteractsWithQueue, SerializesModels;

    protected $data;

    /**
     * Create a new job instance.
     *  创建一个新的任务实例
     * @return void
     */
    public function __construct($data)
    {
        $this->data = $data;
    }

    /**
     *  执行任务
     *
     * @return void
     */
    public function handle()
    {
        $this->job->delete();
        $logger = \App\Libs\Log::get('push_yuyue', 'push_yuyue');
        $url = 'http://wechat.exc360.com/ukeywechat/wechat/template/pushSubscribeMsg';
        $logger->info('推送数据:'.json_encode($this->data));
        $return = curlToJson($url,$this->data);
        $logger->info('返回结果:'.$return);
    }
}
